﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DataModel;
using SchoolDataLayer;

namespace SchoolBusiness
{
  public  class BlStaff
    {
      private readonly DlStaff _dlstaff = new DlStaff();
      public List<Staff> GetAllStaff()
      {
          return _dlstaff.GetAllStaff();
      }
      public int SaveAttendence(StaffAttendence _staffattend)
      {
          return _dlstaff.SaveAttendence(_staffattend);
      }
      public int SavaStaffDetail(Staff _staff, FileData _file)
      {
          return _dlstaff.SaveStaffDetail(_staff, _file);
      }
      public int SaveLoanAmount(Loan _loan)
      {
          return _dlstaff.SaveLoanAmout(_loan);
      }
      public int GetPresentDays(int staffid, int month, int year)
      {
          return _dlstaff.GetPresentDays(staffid, month, year);
      }
      public int GetAbsentDays(int staffid, int month, int year)
      {
          return _dlstaff.GetAbsentDays(staffid, month, year);
      }
      public int SaveSalary(StaffSal _staffsal)
      {
          return _dlstaff.SaveSalary(_staffsal);
      }
      public List<Loan> GetAllLoan()
      {
          return _dlstaff.GetAllLoan();
      }
      public Loan GetLoanBystaff(int staffId)
      {
          List<Loan> loans = GetAllLoan();
          var loan = loans.FirstOrDefault(x => x.staffId == staffId);
          return loan;
      }
    }
}
